"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _jsxRuntime = require("react/jsx-runtime");

var _icons = require("@ant-design/icons");

var _antdV = require("antd-v4");

var _classnames = _interopRequireDefault(require("classnames"));

var _react = require("react");

var BlockCheckbox = function BlockCheckbox(_ref) {
  var value = _ref.value,
      configType = _ref.configType,
      onChange = _ref.onChange,
      list = _ref.list,
      prefixCls = _ref.prefixCls;
  var baseClassName = "".concat(prefixCls, "-drawer-block-checkbox");
  var dom = (0, _react.useMemo)(function () {
    var domList = (list || []).map(function (item) {
      return (0, _jsxRuntime.jsx)(_antdV.Tooltip, {
        title: item.title,
        children: (0, _jsxRuntime.jsx)("div", {
          className: (0, _classnames.default)("".concat(baseClassName, "-item"), "".concat(baseClassName, "-item-").concat(item.key), "".concat(baseClassName, "-").concat(configType, "-item")),
          onClick: function onClick() {
            return onChange(item.key);
          },
          children: (0, _jsxRuntime.jsx)(_icons.CheckOutlined, {
            className: "".concat(baseClassName, "-selectIcon"),
            style: {
              display: value === item.key ? 'block' : 'none'
            }
          })
        })
      }, item.key);
    });
    return domList; // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [value, list === null || list === void 0 ? void 0 : list.length, onChange]);
  return (0, _jsxRuntime.jsx)("div", {
    className: baseClassName,
    style: {
      minHeight: 42
    },
    children: dom
  });
};

var _default = BlockCheckbox;
exports.default = _default;